var http_recvouc = getHTTPObject_recvouc();
var	m_ctrlobj = null;
var	m_ctrlValobj = null;

function getHTTPObject_recvouc()
{
	var xmlhttp;
	try
	{
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} return xmlhttp;
	}
	catch(e)
	{
		alert("Exception");
	}
}


function GBLVdn_Trim(p_sValue)
{
    if(!p_sValue || typeof p_sValue != 'string')
        return "";

    return p_sValue.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');
}


function call_getSchStuList(p_TeacherID)
{	
	var vLoading = "<img src='../images/loader.gif' align='absmiddle'>&nbsp;Loading...";
	document.getElementById("div_studetails").innerHTML=vLoading;
	
	var url="frm_EShd_student_ajax.jsp?TeacherID="+ p_TeacherID;
//alert(url);
	http_recvouc.open("GET", url, true);
	http_recvouc.onreadystatechange = getSchStuList_receive;
	http_recvouc.send(null);
}

function getSchStuList_receive()
{
	if (http_recvouc.readyState == 4) 
	{
	//alert(http_recvouc.status);		
  	 	if (http_recvouc.status == 200) 
	 	{
			var vIsFind = false;
			var res= http_recvouc.responseText;
		//alert(res);
			res = GBLVdn_Trim(res);
			if ( res != null && res != "" )
			{
				var vInfo = res.split("#@@**&&#");
				if ( vInfo.length == 2 )
				{
					document.getElementById("div_studetails").innerHTML = vInfo[0];
					document.getElementById("hid_stuCount").value = vInfo[1];
					vIsFind = true;
				}
			}
			
			if ( !vIsFind )
			{
				var vLoading = "<font color='red'><strong>Records not found.</font>";
				document.getElementById("div_studetails").innerHTML=vLoading;								
			}
		}
	}	
}

function call_getStuAnys(p_Cond)
{	
	var vLoading = "<img src='../images/loader.gif' align='absmiddle'>&nbsp;Loading...";
	document.getElementById("div_studetails").innerHTML=vLoading;
	var url="rpt_stuanys_ajax.jsp?Cond="+ p_Cond;
//alert(url);
	http_recvouc.open("GET", url, true);
	http_recvouc.onreadystatechange = getStuAnys_receive;
	http_recvouc.send(null);
}

function getStuAnys_receive()
{
	if (http_recvouc.readyState == 4) 
	{
	//alert(http_recvouc.status);		
  	 	if (http_recvouc.status == 200) 
	 	{
			var res= http_recvouc.responseText;
		//alert(res);
			res = GBLVdn_Trim(res);
			if ( res != null && res != "" )
				document.getElementById("div_studetails").innerHTML = res;
			else
			{
				var vLoading = "<font color='red'><strong>Records not found.</font>";
				document.getElementById("div_studetails").innerHTML=vLoading;								
			}
		}
	}	
}
